import { backstageRoutes } from '@/router/modules/backstage'
import { constantRoutes } from '@/router'

const state = {
  routes: []
}
const mutations = {
  SET_ALWAYS_ROUTES: (state, routes) => {
    state.routes = routes.concat(constantRoutes)
    console.log('state.routes', state.routes)
  }
}

const actions = {
  getAlwaysRoutes ({ commit }, menus) {
    return new Promise(resolve => {
      commit('SET_ALWAYS_ROUTES', backstageRoutes)
      resolve(backstageRoutes)
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
